//
//  MSUIButton+Additions.m
//  Musou
//
//  Created by danal on 13-1-28.
//
//

#import "MSUIButton+Additions.h"

@implementation UIButton (Musou)

+ (UIButton *)customButtonWithTitle:(NSString *)title background:(UIImage *)backgroundImage{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:title forState:UIControlStateNormal];
    [button setBackgroundImage:backgroundImage forState:UIControlStateNormal];
    return button;
}

+ (UIButton *)customButtonWithImage:(UIImage *)normalImage onImage:(UIImage *)onImage{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:normalImage forState:UIControlStateNormal];
    if (onImage) {
        [button setImage:onImage forState:UIControlEventTouchDown];
    }
    return button;
}

+ (UIButton *)customButtonWithTarget:(id)target action:(SEL)selector image:(UIImage *)normalImage onImage:(UIImage *)onImage{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:normalImage forState:UIControlStateNormal];
    if (onImage) {
        [button setImage:onImage forState:UIControlEventTouchDown];
    }
    [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    return button;
}

@end
